#include "TO_AST.h"
#include "ASTnode.h"
#include "Quadruples.h"
int main(int argc, char **argv)
{
    if (argc >= 3 && argv[2][1] == 'd')
    {
        yydebug = 1;
    }
    parse *root = syntax_process(argv[1]);
    Program *AST_root = nullptr;
    AST_root = parse_to_AST(root);
    if (AST_root != nullptr)
    {
        AST_root->print();
        cout << endl;
    }
    cout << endl << endl;
    list<Quadruple*> Q = GET_PPROGRAM(AST_root);
    cout << "Got Program: " << Q.size() << "\n";
    for(auto it = Q.begin(); it != Q.end(); it++){
        (*it)->println(std::cout);
    }
    return 0;
}